﻿using System;
using System.Collections.Generic;
using System.Text;
using Young3.FMSearch.Core.Entities.GameVersions;
using Young3.FMSearch.Core.Managers;
using Young3.FMSearch.Core.Offsets;
using System.Linq;
using Young3.FMSearch.Core.Attributes;

namespace Young3.FMSearch.Core.Entities.InGame
{
    public class Weather : BaseObject
    {
        public Weather(int memoryAddress, IVersion version)
            : base(memoryAddress, version)
        { }

        [FMEntity(WeatherOffsets.Name)]
        public String Name { get; internal set; }

        [FMPointer(WeatherOffsets.SpringStart)]
        public SpringWeather Spring { get; set; }

        [FMPointer(WeatherOffsets.SummerStart)]
        public SummerWeather Summer { get; set; }

        [FMPointer(WeatherOffsets.AutomnStart)]
        public AutomnWeather Autumn { get; set; }

        [FMPointer(WeatherOffsets.WinterStart)]
        public WinterWeather Winter { get; set; }

        public override string ToString()
        {
            return Name;
        }
    }

    public class SpringWeather : BaseObject
    {
        public SpringWeather(int memoryAddress, IVersion version)
            : base(memoryAddress, version)
        { }

        [FMEntity(WeatherOffsets.SpringStart)]
        public Int16 StartingDay { get; set; }

        [FMPointer(WeatherOffsets.SpringStart)]
        public Precipitation Precipitation { get; set; }

        [FMPointer(WeatherOffsets.SpringStart)]
        public Wind Wind { get; set; }

        [FMPointer(WeatherOffsets.SpringStart)]
        public Temperature Temperature { get; set; }
    }

    public class SummerWeather : BaseObject
    {
        public SummerWeather(int memoryAddress, IVersion version)
            : base(memoryAddress, version)
        { }

        [FMEntity(WeatherOffsets.SummerStart)]
        public Int16 StartingDay { get; set; }

        [FMPointer(WeatherOffsets.SummerStart)]
        public Precipitation Precipitation { get; set; }

        [FMPointer(WeatherOffsets.SummerStart)]
        public Wind Wind { get; set; }

        [FMPointer(WeatherOffsets.SummerStart)]
        public Temperature Temperature { get; set; }
    }

    public class AutomnWeather : BaseObject
    {
        public AutomnWeather(int memoryAddress, IVersion version)
            : base(memoryAddress, version)
        { }

        [FMEntity(WeatherOffsets.AutomnStart)]
        public Int16 StartingDay { get; set; }

        [FMPointer(WeatherOffsets.AutomnStart)]
        public Precipitation Precipitation { get; set; }

        [FMPointer(WeatherOffsets.AutomnStart)]
        public Wind Wind { get; set; }

        [FMPointer(WeatherOffsets.AutomnStart)]
        public Temperature Temperature { get; set; }
    }

    public class WinterWeather : BaseObject
    {
        public WinterWeather(int memoryAddress, IVersion version)
            : base(memoryAddress, version)
        { }

        [FMEntityAttribute(WeatherOffsets.WinterStart)]
        public Int16 StartingDay { get; set; }

        [FMPointer(WeatherOffsets.WinterStart)]
        public Precipitation Precipitation { get; set; }

        [FMPointer(WeatherOffsets.WinterStart)]
        public Wind Wind { get; set; }

        [FMPointer(WeatherOffsets.WinterStart)]
        public Temperature Temperature { get; set; }
    }

    public class Temperature : BaseObject
    {
        public Temperature(int memoryAddress, IVersion version)
            : base(memoryAddress, version)
        { }

        [FMEntityAttribute(WeatherOffsets.TemperatureFreezing)]
        public Byte Freezing { get; set; }

        [FMEntityAttribute(WeatherOffsets.TemperatureCold)]
        public Byte Cold { get; set; }

        [FMEntityAttribute(WeatherOffsets.TemperatureMild)]
        public Byte Mild { get; set; }

        [FMEntityAttribute(WeatherOffsets.TemperatureFine)]
        public Byte Fine { get; set; }

        [FMEntityAttribute(WeatherOffsets.TemperatureWarm)]
        public Byte Warm { get; set; }

        [FMEntityAttribute(WeatherOffsets.TemperatureHot)]
        public Byte Hot { get; set; }

        [FMEntityAttribute(WeatherOffsets.TemperatureVeryHot)]
        public Byte VeryHot { get; set; }
    }

    public class Wind : BaseObject
    {
        public Wind(int memoryAddress, IVersion version)
            : base(memoryAddress, version)
        { }

        [FMEntityAttribute(WeatherOffsets.WindCalm)]
        public Byte Calm { get; set; }

        [FMEntityAttribute(WeatherOffsets.WindBreezy)]
        public Byte Breezy { get; set; }

        [FMEntityAttribute(WeatherOffsets.WindGusty)]
        public Byte Gusty { get; set; }

        [FMEntityAttribute(WeatherOffsets.WindStrong)]
        public Byte Strong { get; set; }

        [FMEntityAttribute(WeatherOffsets.WindGale)]
        public Byte Gale { get; set; }
    }

    public class Precipitation : BaseObject
    {
        public Precipitation(int memoryAddress, IVersion version)
            : base(memoryAddress, version)
        { }

        [FMEntityAttribute(WeatherOffsets.PrecipitationDry)]
        public Byte Dry { get; set; }

        [FMEntityAttribute(WeatherOffsets.PrecipitationWet)]
        public Byte Wet { get; set; }

        [FMEntityAttribute(WeatherOffsets.PrecipitationDrizzle)]
        public Byte Drizzle { get; set; }

        [FMEntityAttribute(WeatherOffsets.PrecipitationShower)]
        public Byte Shower { get; set; }

        [FMEntityAttribute(WeatherOffsets.PrecipitationDownPour)]
        public Byte DownPour { get; set; }
    }
}